package com.infore.exchange.main.service;

import com.infore.common.model.dto.TreeDto;
import com.infore.common.model.dto.exchange.TableIndexDto;
import com.infore.common.model.entity.exchange.TDatabaseInfo;
import com.baomidou.mybatisplus.service.IService;
import com.infore.common.response.ApiResponse;
import com.infore.metadata.core.model.ColumnModel;
import com.infore.metadata.core.model.SimpleDataSource;
import com.infore.metadata.core.model.TableModel;
import com.infore.screw.core.metadata.Table;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 数据库信息表 服务类
 * </p>
 *
 * @author lijh
 * @since 2023-02-07
 */
public interface TDatabaseInfoService extends IService<TDatabaseInfo> {
    boolean checkDatabaseConnect(TDatabaseInfo TDatabaseInfo);
    SimpleDataSource getDatabaseConnect(TDatabaseInfo TDatabaseInfo);
    List<TreeDto> getDatasourcesGroupByDatabaseType(String tableName);
    List<TreeDto> getDatasourcesAllTableInfo(String tableName);
    List<String> getTablesNameByDatabaseId(String databaseId);
    List< Map<String,Object>> getTableInfoByDatabaseId(String databaseId,String tableName);
    List<ColumnModel> getTablesColumns(String databaseId, String tableName);
    List<Map<String, String>> getTablesIncreColumns(String databaseId,String tableName);
    Map<String,Object> getDatabaseRowNumAndTotalSpace();
    Map<String, Integer> getSchematabes();
    List<TableIndexDto> getTablesIndexs(String databaseId, String tableName);
    ApiResponse updateTableComment(String databaseId, String tableName, String comment);
}
